package com.dadi.mashangkaixue

/**
 *  author: 韦敏敏
 *  date: 2020/1/31 0031
 */
class A<T> (val t: T, val t2 : T, val t3 : T)
class Apple(var name : String)
fun main(args: Array<String>){
    // 使用类
    val a1: A<*> = A(12, "String", Apple("苹果"))
    val a2: A<Any?> = A(12, "String", Apple("苹果")) // 和a1是一样的
    val apple = a1.t3 // 参数类型为Any
    println(apple)
    val apple2 = apple as Apple // 强转成Apple类
    println(apple2.name)
    // 使用数组
    val me:ArrayList<Any?> = arrayListOf("String",1,1.2f, Apple("苹果"), null)
    for (item in me){
        println(item)
    }
}